package com.example.demo.lab2.controller;

import com.example.demo.lab2.entity.Employees;
import com.example.demo.lab2.entity.Jobs;
import com.example.demo.lab2.service.JobsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;
import java.util.List;

@RequestMapping("/v1")
@RestController
public class JobsController {
    @Autowired
    JobsService jobsService;
    @GetMapping("/jobs/list")
    public ResponseEntity<?> list() {
        List<Jobs> list = jobsService.list();
        return ResponseEntity.ok(list);
    }

    @PostMapping("/jobs/insert")
    public ResponseEntity<?> insert(@RequestBody Jobs jobs) {
        int insert = jobsService.insert(jobs);
        return ResponseEntity.ok(insert);
    }
    @PostMapping("/jobs/update")
    public ResponseEntity<?> update(@RequestBody Jobs jobs){
        int update = jobsService.update(jobs);
        return ResponseEntity.ok(update);
    }
    @PostMapping("/jobs/delete")
    public ResponseEntity<?> delete(@RequestParam("id") String id ){
        int delete = jobsService.delete(id);
        return ResponseEntity.ok(id);
    }
}
